<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算机</title>
	</head>
	<body>
		<form action="" method="">
			<table border="0PX" cellspacing="" cellpadding="">
				<tr>
					<td>
						<input type="text" id="no1" value="" />
					</td>
					<td>
						<select name="FH" id="FH" style="width: 50px;">
							<option value="" id="+">+</option>
							<option value="" id="-">-</option>
							<option value="" id="*">*</option>
							<option value="" id="/">/</option>
						</select>
					</td>
					<td>
						<input type="text" id="no2" value="" />
					</td>
					<td>
					    <button type="button" onclick="operation()">提交</button>						
					</td>
					<td>
						<input type="text" name="" id="JG" />
					</td>
				</tr>
			</table>
		</form>
		
	</body>
	<script type="text/javascript">
		function operation(){
			var no1=parseFloat(document.getElementById('no1').value);
			console.log('第一个值'+no1);
			var no2=parseFloat(document.getElementById('no2').value);
			console.log('第二个值'+no2);
			var result=0;
			var FH=document.getElementById('FH'); //定位查询的下拉框id
			console.log(FH);
			var index=FH.selectedIndex;  //定位选中的索引
			console.log(index);
			if(index==0){
				result=no1+no2;
			}else if(index==1){
				result=no1-no2;
			}else if(index==2){
				result=no1*no2;
			}else{
				result=no1/no2;
			}
			console.log(result);
			document.getElementById('JG').value=result;
		}
	</script>
</html>
